#ifndef TEVENTTHREAD_HEAD_H
#define TEVENTTHREAD_HEAD_H

#include "TThread.h"
#include "TPlayerHandler.h"

#ifdef WIN32
#include "TSelectScheduler.h"
#else
 #include "TEpollScheduler.h"
#endif

class TEventThread :
	public TThread
{
private:
#ifndef WIN32
	TEpollScheduler					m_scheduler;
#else
	TSelectScheduler				m_scheduler;
#endif
	
	bool							m_exit;
	std::vector< TEventHandler * >  m_handles;
	time_t							m_current_time;
	TMutexLock						m_lock;
public:
	TEventThread(void);
public:
	virtual ~TEventThread(void);
public:
	time_t get_ative_time(){
		return m_current_time ;
	}
	void	stop(){ m_exit = true ;}
	bool	register_handler( TEventHandler * handler );
protected:
	virtual void run( void * object );
	void check_timeout();

};

#endif

